<include file="../Public/header" />
<script src="__PUBLIC__/admin/js/lib/jquery.js"></script>
<script src="./Public/js/ui/jquery.ui.widget.js"></script>
<script src="./Public/js/ui/jquery.ui.progressbar.js"></script>
<style>
    .container { margin-top: 5px; height: 50px;}
    #progressbar { float: left; width: 300px;}
    #msg { float: left; padding-left: 10px; font-size: 16px; }

    .ui-widget-content {
        border: 1px solid #dcdcdc;
        background: #ffffff 50% 50% repeat-x;
        color: #222222;
    }
    .ui-widget {
        font-family: Verdana, Arial, sans-serif;
        font-size: 1.1em;
    }
    .ui-progressbar {
        height: 2em;
        text-align: left;
        overflow: hidden;
    }
    .ui-progressbar .ui-progressbar-value {
        margin: -1px;
        height: 100%;
    }
    .ui-widget-header {
        border: 1px solid #aaaaaa;
        background: #1abc9c 50% 50% repeat-x !important;
        color: #222222;
        font-weight: bold;
    }
</style>

<script type="text/javascript">
    $(function () {
        /*页面总数*/
        var count = {$total},
            token = '{$token}';
        function control(currentj, count, t) {
            var total = Math.floor((currentj / count) * 100);
            $("#progressbar").progressbar({
                value: total
            });
            $("#ti").text("任务完成:" + total + "%");
            $("#msg").text(currentj + "/" + count);
        }
        control(0, count, '栏目');
                var _create_content_url = '{:URL('cms/Create/createCatePage')}',
                i = 1;
        (function createPage() {
            $.get(_create_content_url,{token:token,i:i},function (data) {
                if (data.status == 0) {
                    //页面过期，刷新页面
                    location.reload();
                } else {
                    if('uncomplete' != data.data.footbar){
                        i++;
                    }
                    if (count == data.data.completePage) {
                        control(count, count, '内容');
                    } else {
                        control(data.data.completePage, count, '内容');
                        createPage();
                    }
                }
            });
        })();
    });
</script>
</head>

<body>
    <div class="page">
        <!-- <p>{$message}</p> -->
        <p id="ti"></p>
        <div class="container clearfix">
            <div id="progressbar"></div>
            <p id="msg"></p>
        </div>
        <a href="javascript:history.go(-1)" class="btn">返回</a>
    </div>
</body>

</html>
